﻿<%@ Page Title="" Language="C#" MasterPageFile="~/AdminCP/AdminTemplate.Master" AutoEventWireup="true"
    CodeBehind="ManageAdmins.aspx.cs" Inherits="RealtorsPortal.AdminCP.ManageAdmins" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <title>Admins Management</title>
    <script language="javascript" type="text/javascript">
        $(document).ready(function () {
            //set option
            $("#navheadAdmin").addClass("selected");
            $("#mnuAdmin").css("display", "block");
            $(".submenu li a[title='Manage admins']").css({ "color": "#fff", "background": "#222", "border": "1px solid #333" });

            $("#contentArea").tabs(); //tab view
        });
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <h1>
        AMINS MANAGEMENT</h1>
    <div id="contentArea">
        <ul>
            <li><a href="#tab1">Admins list</a></li>
            <li><a href="#tab2">Add new admin account</a></li>
        </ul>
        <div id="tab1">
            <h2>
                Admin accounts</h2>
            <fieldset>
                <div style="float:right;">
                        Search by Username: 
                    <asp:TextBox ID="txtKeyword" runat="server"></asp:TextBox>
                    <asp:LinkButton ID="lbtnSearch" runat="server" CssClass="submit" 
                            style="float:none;" onclick="lbtnSearch_Click">GO</asp:LinkButton>
                </div>
            </fieldset>

            <asp:GridView ID="grvAdmins" runat="server" AutoGenerateColumns="false" DataKeyNames="AdminId"
                OnRowCancelingEdit="grvAdmins_RowCancelingEdit" OnRowCommand="grvAdmins_RowCommand"
                OnRowEditing="grvAdmins_RowEditing" AllowPaging="True" 
                onpageindexchanging="grvAdmins_PageIndexChanging" PageSize="5" 
                onrowdeleting="grvAdmins_RowDeleting" Width="100%">
                <HeaderStyle CssClass="header_gridview" />
                <Columns>
                    <asp:CheckBoxField />
                    <asp:TemplateField HeaderText="ID">
                        <ItemTemplate>
                            <%# Eval("AdminId")%>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Username">
                        <ItemTemplate>
                            <%# Eval("Username")%>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="etxtUsername" runat="server" Text='<%# Bind("Username") %>' Visible="true"></asp:TextBox>
                        </EditItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Email">
                        <ItemTemplate>
                            <%# Eval("Email")%>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="etxtEmail" runat="server" Text='<%# Bind("Email") %>' Visible="true"></asp:TextBox>
                        </EditItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Full name">
                        <ItemTemplate>
                            <%# Eval("Fullname")%>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="etxtFullName" runat="server" Text='<%# Bind("Fullname") %>' Visible="true"></asp:TextBox>
                        </EditItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Actions">
                        <ItemTemplate>
                            <asp:LinkButton ID="LinkButton1" runat="server" CommandName="Edit"
                                CommandArgument='<%# DataBinder.Eval(Container, "RowIndex") %>' >
                                <asp:Image ID="ibtnEdit" runat="server" ImageUrl="assets/b_edit.png"/>
                                </asp:LinkButton>
                            <asp:LinkButton ID="LinkButton2" runat="server" CommandName="Delete"
                                CommandArgument='<%# DataBinder.Eval(Container, "RowIndex") %>' OnClientClick='javascript:return confirm("Are you sure you want to delete?")'>
                                <asp:Image ID="Image1" runat="server" ImageUrl="assets/b_drop.png"/>
                                </asp:LinkButton>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:LinkButton ID="lbtnUpdate" runat="server" ValidationGroup="update" CausesValidation="True"
                                CommandName="UpdateComponent" Text="Update" CommandArgument='<%# DataBinder.Eval(Container, "RowIndex") %>'></asp:LinkButton>
                            <asp:LinkButton ID="lbtnCancel" runat="server" ValidationGroup="update" CausesValidation="True"
                                CommandName="Cancel" Text="Cancel" CommandArgument='<%# DataBinder.Eval(Container, "RowIndex") %>'></asp:LinkButton>
                        </EditItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <PagerStyle CssClass="pager_gridview" Width="50px" />
            </asp:GridView>
            <asp:Label ID="Label1" runat="server" Text="Display: "></asp:Label><asp:DropDownList
                ID="ddlPageSize" runat="server" AutoPostBack="True" 
                onselectedindexchanged="ddlPageSize_SelectedIndexChanged">
                <asp:ListItem>5</asp:ListItem>
                <asp:ListItem>10</asp:ListItem>
                <asp:ListItem>20</asp:ListItem>
            </asp:DropDownList>
        </div>
        <div id="tab2">
            <h2>Add a admin account</h2>
            <fieldset>
            <legend>Account information</legend>
                <asp:ValidationSummary ID="ValidationSummary1" runat="server" 
                    ValidationGroup="add" Font-Bold="True" ForeColor="Red" />
            <div class="input_field">
                <label>
                    Username(*):
                </label>
                <asp:TextBox ID="txtUserName" runat="server" Width="215px" >
                </asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                    ControlToValidate="txtUsername" ErrorMessage="Username is required" Font-Bold="True" 
                    ForeColor="Red" Text="*" ValidationGroup="add"></asp:RequiredFieldValidator>
            </div>

            <div class="input_field">
                <label>
                    Password(*):
                </label>
                <asp:TextBox ID="txtPassword" runat="server" Width="215px" TextMode="Password">
                </asp:TextBox>

                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                    ErrorMessage="Password is required" Font-Bold="True" 
                    ForeColor="Red" ControlToValidate="txtPassword" Text="*" ValidationGroup="add"></asp:RequiredFieldValidator>
            </div>

            <div class="input_field">
                <label>
                    Confirm(*):
                </label>
                <asp:TextBox ID="txtConfirm" runat="server" Width="215px" TextMode="Password">
                </asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                    ErrorMessage="Confirm is required" Font-Bold="True" 
                    ForeColor="Red" ControlToValidate="txtConfirm" Text="*" ValidationGroup="add"></asp:RequiredFieldValidator>
                <asp:CompareValidator ID="CompareValidator1" runat="server" 
                    ErrorMessage="Password doesn't matches!" Text="*" 
                    ControlToCompare="txtPassword" ControlToValidate="txtConfirm" Font-Bold="True" 
                    ForeColor="Red"></asp:CompareValidator>
            </div>

            <div class="input_field">
                <label>
                    Email:
                </label>
                <asp:TextBox ID="txtEmail" runat="server" Width="215px">
                </asp:TextBox>
                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                    ErrorMessage="Email is invalid" Font-Bold="True" 
                    ForeColor="Red" ControlToValidate="txtEmail" Text="*" ValidationGroup="add"
                    ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
            </div>

            <div class="input_field">
                <label>
                    Full name:
                </label>
                <asp:TextBox ID="txtFullName" runat="server" Width="215px"></asp:TextBox>
            </div>
            <div class="input_field no_margin_bottom">
            <label>&nbsp;</label>
            <asp:Button ID="btnAdd" runat="server" Text="ADD" CssClass="submit" 
                    ValidationGroup="add" onclick="btnAdd_Click" />
            <input class="submit" type="reset" value="RESET" />
            
        </div>
        </fieldset>
        </div>
    </div>
</asp:Content>
